package nancal.mp.db.mongo.table

import java.io.*
import nbcp.base.db.*
import nbcp.base.comm.*
import nbcp.base.extend.*
import nbcp.base.enums.*
import nbcp.base.utils.*
import nbcp.myoql.db.*
import nbcp.myoql.db.comm.*
import nbcp.myoql.db.enums.*
import nbcp.myoql.db.mongo.*
import nbcp.myoql.db.mongo.base.*
import nbcp.myoql.db.mongo.component.*
import org.slf4j.LoggerFactory
import org.springframework.stereotype.*


@Component("mongo.yapi")
@MetaDataGroup(DatabaseEnum.Mongo, "yapi")
class YapiGroup : IDataGroup {
    override fun getEntities(): Set<BaseMetaData<out Any>> = setOf(api, api_cat, group, project, user)


    /**
     * 接口
     */
    val api get() = apiEntity();



    /**
     * 接口
     */
    val api_cat get() = api_catEntity();



    /**
     * 组
     */
    val group get() = groupEntity();



    /**
     * 项目
     */
    val project get() = projectEntity();



    /**
     * 用户
     */
    val user get() = userEntity();


    /**
     * 接口
     */
    @nbcp.base.db.annotation.Cn(value = """接口""")
    @org.springframework.data.mongodb.core.mapping.Document()
    @nbcp.base.db.annotation.DbName(value = """interface""")
    @nbcp.base.db.annotation.DbEntityGroup(value = """yapi""")
    class apiEntity(collectionName: String = "interface") :
        MongoBaseMetaCollection<nancal.mp.db.mongo.entity.yapi.api>(nancal.mp.db.mongo.entity.yapi.api::class.java, collectionName) {

        val id = MongoColumnName("_id")

        val uid = MongoColumnName("uid")

        val catid = MongoColumnName("catid")

        val catName = MongoColumnName("catName")

        val tag = MongoColumnName("tag")

        val project_id = MongoColumnName("project_id")

        /**
         * 名称
         */
        @nbcp.base.db.annotation.Cn(value = """名称""") 
        val title = MongoColumnName("title")

        val path = MongoColumnName("path")

        val req_body_other = MongoColumnName("req_body_other")

        val res_body = MongoColumnName("res_body")

        val req_params = api_paramsMeta("req_params")

        val method = MongoColumnName("method")

        val desc = MongoColumnName("desc")

        val req_headers = api_headerMeta("req_headers")

    }

    /**
     * 接口
     */
    @nbcp.base.db.annotation.Cn(value = """接口""")
    @org.springframework.data.mongodb.core.mapping.Document()
    @nbcp.base.db.annotation.DbName(value = """interface_cat""")
    @nbcp.base.db.annotation.DbEntityGroup(value = """yapi""")
    class api_catEntity(collectionName: String = "interface_cat") :
        MongoBaseMetaCollection<nancal.mp.db.mongo.entity.yapi.api_cat>(nancal.mp.db.mongo.entity.yapi.api_cat::class.java, collectionName) {

        val id = MongoColumnName("_id")

        /**
         * 名称
         */
        @nbcp.base.db.annotation.Cn(value = """名称""") 
        val name = MongoColumnName("name")

        val project_id = MongoColumnName("project_id")

        val uid = MongoColumnName("uid")

    }

    /**
     * 组
     */
    @nbcp.base.db.annotation.Cn(value = """组""")
    @org.springframework.data.mongodb.core.mapping.Document()
    @nbcp.base.db.annotation.DbEntityGroup(value = """yapi""")
    class groupEntity(collectionName: String = "group") :
        MongoBaseMetaCollection<nancal.mp.db.mongo.entity.yapi.group>(nancal.mp.db.mongo.entity.yapi.group::class.java, collectionName) {

        val id = MongoColumnName("_id")

        val uid = MongoColumnName("uid")

        val type = MongoColumnName("type")

        /**
         * 名称
         */
        @nbcp.base.db.annotation.Cn(value = """名称""") 
        val group_name = MongoColumnName("group_name")

    }

    /**
     * 项目
     */
    @nbcp.base.db.annotation.Cn(value = """项目""")
    @org.springframework.data.mongodb.core.mapping.Document()
    @nbcp.base.db.annotation.DbEntityGroup(value = """yapi""")
    class projectEntity(collectionName: String = "project") :
        MongoBaseMetaCollection<nancal.mp.db.mongo.entity.yapi.project>(nancal.mp.db.mongo.entity.yapi.project::class.java, collectionName) {

        val id = MongoColumnName("_id")

        val name = MongoColumnName("name")

        val uid = MongoColumnName("uid")

        val project_type = MongoColumnName("project_type")

        val group_id = MongoColumnName("group_id")

    }

    /**
     * 用户
     */
    @nbcp.base.db.annotation.Cn(value = """用户""")
    @org.springframework.data.mongodb.core.mapping.Document()
    @nbcp.base.db.annotation.DbName(value = """user""")
    @nbcp.base.db.annotation.DbEntityGroup(value = """yapi""")
    class userEntity(collectionName: String = "user") :
        MongoBaseMetaCollection<nancal.mp.db.mongo.entity.yapi.user>(nancal.mp.db.mongo.entity.yapi.user::class.java, collectionName) {

        val id = MongoColumnName("_id")

        val study = MongoColumnName("study")

        val email = MongoColumnName("email")

        val type = MongoColumnName("type")

        val username = MongoColumnName("username")

        val password = MongoColumnName("password")

        val passsalt = MongoColumnName("passsalt")

        val role = MongoColumnName("role")

    }

}

